#include "dokereditor.h"

#include <QtCore/qdebug.h>

DokerEditor::DokerEditor(const QString &fileName, const QString &content, QWidget *parent) :
    QPlainTextEdit(parent)
{
    m_fileName = fileName;
    m_isModified = false;
    setLineWrapMode(QPlainTextEdit::NoWrap);
    QFont myFont("Courier", 10);
    setFont(myFont);
    setPlainText(content);
    connect(this, SIGNAL(textChanged()), this, SLOT(setModified()));
}

void DokerEditor::apply()
{
    if (m_isModified)
    {
        m_isModified = false;
        emit modified(m_isModified);
    }
}

void DokerEditor::setModified()
{
    if (!m_isModified)
    {
        m_isModified = true;
        emit modified(m_isModified);
    }
}

